home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 8 / Amoszine 8 (Disk 2 of 3).adf / Powerbobs.lha / powerbobsv1.0 / examples / amal_psprites_60_speed.asc < prev    next >
Text File  |  1995-07-04  |  3KB  |  106 lines

  1. 'This demo is for Amiga's with a 68000 processor : 
  2. '  standard A500 and A500+ 
  3. '  standard A600 
  4. '  standard A2000
  5. '  standard A1000  Phew lucky you !!! It's a candy ! 
  6. '
  7. Screen Open 0,320,200,2,L
  8. Load "df0:examples/amal_60_sprites.abk"
  9. Hide On 
  10. '
  11. 'We are only using 60 Psprites, so set the maximum to 60 
  12. 'This will save some time, specially on 68000 based machines.
  13. '
  14. Psprite Max 60
  15. 'We've 16 coloured images in bank 1, so set the Psprite engine in 16 colour
  16. 'mode. 
  17. '
  18. Set Psprite Colours 16
  19. '
  20. 'Convert the Sprite/Bob images in bank 1 from normal format  
  21. 'to interleaved bitmap format. 
  22. '
  23. Convert Sprites 1
  24. '
  25. 'Remember, after conversion the bank can be erased ! 
  26. 'This will free a lot of your precious memory. 
  27. Erase 1
  28. '
  29. Unpack 10 To 0
  30. '
  31. 'It is very important to set the normal Bob and Sprite updates to Off !
  32. '
  33. Update Off 
  34. '
  35. 'Set Synchro mode to off, because we use 60 ! channels !!! 
  36. 'I could use all 64 channels, but the screen isn't large enough !!!! 
  37. '  
  38. Synchro Off 
  39. '
  40. 'Don't bother about the AMAL setup, just for testing...
  41. '
  42. Y=42
  43. NUM_SPR=0
  44. For I=0 To 14
  45.    Randomize Timer
  46.    X=128+64
  47.    X_ADD=80
  48.    For _PSPR=1 To 4
  49. 'Use this line for a nice pattern... 
  50.       A$="Let X="+Str$(X)-" "+"; Let Y="+Str$(Y)-" "+"Let R0="+Str$(-_PSPR)+";Let R1=1;Let R2=1;Let A=Z(5)+1"
  51. 'Use this line for total chaos ! 
  52. '      A$="Let X="+Str$(X)-" "+"; Let Y="+Str$(Y)-" "+"Let R0="+Str$(-(Rnd(3)+1))+";Let R1=1;Let R2=1;Let A=Z(5)+1"
  53. '
  54. 'I've slowed down the speed with 4 Pause instructions, else the images are 
  55. 'flipping too fast!
  56. '
  57.       A$=A$+"Loop: P ;P ;P ; P;"
  58.       A$=A$+"Let X=X+R0 ;"
  59.       A$=A$+"If X>432 Jump Reset ;"
  60.       A$=A$+"If X<"+Str$(128+NUM_SPR)-" "+" Jump Reset ;"
  61.       A$=A$+"Let A=A+R1;"
  62.       A$=A$+"If A>7 Jump Image;"
  63.       A$=A$+"Jump Loop ;"
  64.       A$=A$+"Reset: ;"
  65.       A$=A$+"Let R0=R0*-1 ;"
  66.       A$=A$+"Jump Loop ;"
  67.       A$=A$+"Swapy: ;"
  68.       A$=A$+"Let R2=R2*-1 ;"
  69.       A$=A$+"Jump Loop ;"
  70.       A$=A$+"Image: ;"
  71.       A$=A$+"Let A=1 ;"
  72.       A$=A$+"Jump Loop ;"
  73.       Amal NUM_SPR,A$
  74.       Inc NUM_SPR
  75.       Add X,X_ADD
  76.    Next 
  77.    Add Y,17
  78. Next 
  79. '
  80. 'Assign the Psprites to an Amal channel... 
  81. '
  82. For I=0 To 59
  83.    Pchannel To Psprite I To I
  84. Next 
  85. '
  86. 'Let's go !
  87. '
  88. Amal On 
  89. Multi No 
  90. R=Execall(-132)
  91. ' Whe use 4 Pause instructions in the Amal progs, so synchronize it to 
  92. ' the same speed.
  93. Psync Every 4
  94. T=Timer
  95. For I=1 To 1000
  96.    ' Ok transfer the X/Y and A values to the Psprites and Update them on screen.  
  97.    '  
  98.    Synchro 
  99.    Psync Psprite 0 To 59
  100. Next 
  101. Print Timer-T
  102. R=Execall(-138)
  103. Multi Yes 
  104. Erase 1
  105. Erase 10
  106.